package com.store.pet.petstore.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.droidbyme.dialoglib.DroidDialog;
import com.gyf.barlibrary.ImmersionBar;
import com.store.pet.petstore.R;

import butterknife.BindView;
import butterknife.OnClick;

public class AboutActivity extends BaseActivity {
    @BindView(R.id.my_status)
    View myStatus;
    @BindView(R.id.toolbar)
    Toolbar toolbar;

    private DroidDialog dialog;  //拨打电话的弹窗

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getLayoutID() {
        return R.layout.activity_about;
    }


    @Override
    public void init(Bundle savedInstanceState) {
        //沉浸式标题栏
        ImmersionBar.with(this).statusBarDarkFont(true).init();
        takeLinearStatusBar(myStatus);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationIcon(R.drawable.fanhui);  //设置左上角图标
        toolbar.setNavigationOnClickListener(view -> finish());  //退出
    }

    @Override
    public void loadData() {

    }

    @OnClick({R.id.kefu})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.kefu:
                //呼叫卖家电话
                dialog = new DroidDialog.Builder(this)
                        .title("温馨提示")
                        .content("是否确认客服电话" +"17844602526"+ "？")
                        .cancelable(false, false)
                        .positiveButton("确定", droidDialog -> {
                            Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "17844602526"));
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            startActivity(intent);
                            dialog.dismiss();
                        })
                        .negativeButton("取消", droidDialog -> dialog.dismiss()).show();
                break;
        }
    }
}
